import 'dart:convert';

import 'package:ichinesereader/models/book/Book.dart';

MyLibraryBooks myLibraryBooksFromJson(String str) => MyLibraryBooks.fromJson(json.decode(str));

String myLibraryBooksToJson(MyLibraryBooks data) => json.encode(data.toJson());

class MyLibraryBooks {
    MyLibraryBooks({
        this.id,
        this.folderName,
        this.books,
    });

    String? id;
    String? folderName;
    List<Book>? books;

    factory MyLibraryBooks.fromJson(Map<String, dynamic> json) => MyLibraryBooks(
        id: json["id"],
        folderName: json["folderName"],
        books: json["books"]!=null ? List<Book>.from(json["books"].map((x) => Book.fromJson(x))) : null,
    );

    Map<String, dynamic> toJson() => {
        "id": id,
        "folderName": folderName,
        "books": books!=null ? List<dynamic>.from(books!.map((x) => x.toJson())) : null,
    };
}